export default class {
	constructor(Konva,scale = 50, x = 100, y = 100, bgColor = "yellow", pointColor = "#000") {
		this.Konva = Konva;
		this.scale = scale;
		this.bgColor = bgColor;
		this.pointX = x;
		this.pointY = y;
	}
	draw() {
		let self = this;
		return new this.Konva.Shape({
			sceneFunc: function(ctx) {
				// 绘制灯泡身体
				ctx.beginPath();
				// 圆心，半径，起始位置，弧度，方向
				ctx.arc(self.pointX, self.pointY, self.scale, 0, Math.PI, 1);
				ctx.fillStyle = self.bgColor;
				ctx.fill();
				
				// 绘制灯泡的边框
				ctx.beginPath();
				ctx.arc(self.pointX, self.pointY, self.scale, 0, Math.PI, 1);
				ctx.lineTo((self.pointX - self.scale), self.pointY);
				ctx.lineTo(self.pointX, self.pointY + self.scale);
				ctx.strokeStyle = self.bgColor
				ctx.stroke();
				// ctx.closePath();
				ctx.fill();
				// 绘制小灯泡的亮点
				ctx.beginPath();
				ctx.arc(self.pointX, self.pointY + self.scale, 5, 0, 2 * Math.PI);
				ctx.fillStyle = self.pointColor;
				ctx.fill();
			}
		})
	}
}